You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing training@inductiveautomation.com.
LESSON LIST
LESSON
Building an Ignition SDK Module
Description
Learn the mechanics of building an SDK module project in IntelliJ into an installable .modl module file for Ignition.
Transcript
(open in window)[00:00] In this lesson, we'll show how to load an existing Ignition SDK module project into our IDE, and how to build it into an installable module file that can be loaded and run in Ignition. Our emphasis in this lesson will be on the indicated portion of the development workflow. In a prior lesson, we pulled a training example repository from GitHub into our local development environment workspace using Git. But we did mention Git wasn't the only way to do that, we also could have used GitHub directly. Either way, now that we have a working code project on hand, we'll load it into IntelliJ, where we'll use Gradle in the background to build it into an Ignition SDK module, an .modl file that will be installed into Ignition and run in a following lesson. This is all a pretty simple process, but one which likely will be done over and over again. So let's see how it's done. Assuming you've just installed your IntelliJ, you won't have any recently loaded projects to display, so your startup window may look something like this.
[01:09] So we'll select the O pen option and we'll navigate down to the training repository folder we brought over. And there we'll go down one more level and select our training example scripting-function-G, which represents a top level project folder we want to load into IntelliJ. In case you're curious, this project will add one scripting function to Ignition, and it will be built using Gradle, hence the -G designation. But by the way, that is not a naming convention requirement, it's just what we're using here. So once we click OK, we'll have our scripting-function-G project open in IntelliJ. Now, I've opened this project multiple times before. If this is the first time opening this project, you may have to wait a bit until IntelliJ goes through its dependency resolution steps. So watch for any progress update messages on that. By dependency resolution, we mean the automated process by which Gradle identifies and retrieves all software artifacts needed to compile and build an installable .modl file.
[02:11] And note that this can take several minutes to complete if it's the first time through the process. So don't be concerned if it seems to take awhile. Notice on the left that the project structure is mostly collapsed by intention. We will circle back around in a later lesson to look this code over and understand its structure in a bit more detail. But for now, we'll take it on faith that this is a working example and we are just focused on the mechanics of the build process for now. Over on the right side of our IntelliJ, we'll see the Gradle tool window. If you don't see this, you can always restore it by doing View > Tool Windows > Gradle. The actions we'll be interested in are back on the right, under Tasks, then build. Just to quickly define our terms here, build is to compile all the needed software artifacts and combine them into an installable, runnable module file.
[03:04] And clean is to clear out all compiled files and freshly recompile every file each time. Generally, we do not need to do this every time. Usually only any changed files will be recompiled as needed, but I kind of prefer to know I'm doing a fully clean build from time to time. But strictly speaking, this next step is optional. So we'll select clean, then right click and select this first option with a green run icon, even though this menu option is clipped off. And we'll let Gradle perform the needed cleanup actions until we see this Build Successful message below. Then we'll go back and select Build, right click and select this first option again with a green run icon. And once we've done these at least once, we can also select the clean and build options, or run configurations rather, from this dropdown menu. Anyway, this time Gradle is going to traverse our project structure and perform all needed compile and build tasks. Once again, we'll be looking for this Build Successful message to know that we're done.
[04:08] What we've just done through all this is to compile and build an installable Ignition module file. We can see the result in our file browser if we navigate down into the scripting-function-G project directory, then into the build directory, and we can spot check from the timestamp that this in fact represents the recently built .modl file. Okay, so in this lesson, we've built a working Ignition SDK training example into an installable module file. In the next lesson, we'll show how to load this module into Ignition and run it.